/**
 * 
 */
package fr.upvm.lem3.vm3d.ui.swing.frontend;

import java.util.Vector;

import javax.swing.DefaultComboBoxModel;

import fr.upvm.lem3.vm3d.domain.Channel;
/**
 * A custom comboxBox model class. It take advantage of 
 * the DefaultComboBoxModel 
 *******************************************************************
 *MyComboBoxModel.java
 *27.02.2012
 *@author Guy Nougouapi
 *******************************************************************
 *
 *******************************************************************
 */
public class MyComboBoxModel<Channel> extends DefaultComboBoxModel{

	public MyComboBoxModel(){
		super();
	}

	public MyComboBoxModel(Channel[] items){
		super(items);
	} 
	public MyComboBoxModel(Vector<Channel> vec){
		super(vec);
	} 
	
	public void addElements(Vector<Channel> vec){
		for(Channel chl: vec){
			super.addElement(chl);
		}
	}
	public void addElements(Channel[] items){
		for(Channel chl: items){
			super.addElement(chl);
		}
	}
	/**
	 * Add the elements into the model started by index startPositions
	 * @param items list of items to add
	 * @param startIndex   startposition by addind
	 */
	public void addElements(Channel[] items, int startIndex){
	
		if(!(startIndex >= items.length )){
			for(int i = startIndex; i < items.length ; i++){
				super.addElement(items[i]);
			}
		}
	}
	
	/**
	 * Remove all items from the item list
	 */
	public void removeAllElements(){
		super.removeAllElements();
	}
}
